//
//  PayTableViewCell.m
//  PeopleStreet
//
//  Created by 辰领科技 on 16/1/16.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "PayTableViewCell.h"

@implementation PayTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView * line = [[UIView alloc]initWithFrame:flexibleFrame(CGRectMake(0, 43, 320, 1), NO)];
        line.backgroundColor = [UIColor colorWithWhite:0.925 alpha:1.000];
        [self.contentView addSubview:line];
        
        _bankImage = [[UIImageView alloc]init];
        _bankImage.frame = flexibleFrame(CGRectMake(18, 12, 27, 27), NO);
        [self.contentView addSubview:_bankImage];
        
        _bankName =  [[UILabel alloc]initWithFrame:flexibleFrame(CGRectMake(58, 0, 200, 44), NO)];
        _bankName.textAlignment = NSTextAlignmentLeft;
        _bankName.textColor = [UIColor colorWithWhite:0.196 alpha:1.000];
        _bankName.font = [UIFont systemFontOfSize:16*VerticalTexeRatio()];
        [self.contentView addSubview:_bankName];
        
        UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = flexibleFrame(CGRectMake(283, 11, 22, 22), NO);
        [button setBackgroundImage:[UIImage imageNamed:@"shopping5"] forState:UIControlStateNormal];
        [button setBackgroundImage:[UIImage imageNamed:@"shopping4"] forState:UIControlStateSelected];
        _choseButton = button;
        [self.contentView addSubview:button];
        
        UIButton * Button = [UIButton buttonWithType:UIButtonTypeCustom];
        Button.frame = flexibleFrame(CGRectMake(0, 0, 320, 44), NO);
       Button.backgroundColor = [UIColor clearColor];
        _choseupButton = Button;
        [self.contentView addSubview:Button];
        [Button addTarget:self action:@selector(chosen:) forControlEvents:UIControlEventTouchUpInside];
    }

    return self;
}


- (void)chosen:(UIButton *)sender{
    sender.selected = !sender.selected;
    _choseButton.selected = sender.selected;
    if (sender.selected) {
        _choseBlock(@"1");
    }else{
        _choseBlock(@"0");
    }

}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
